/*
 * @Author: 江舟 jijiangzhou@recycloud.cn
 * @Date: 2024-03-27 09:13:26
 * @LastEditors: 江舟 jijiangzhou@recycloud.cn
 * @LastEditTime: 2024-04-18 14:11:02
 * @FilePath: \vite-project\src\components\org\OrgUserInfoForm.tsx
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */

import { Form, Input, Radio } from 'antd';
import React, { MouseEventHandler } from 'react';
import TenantOrgRole from './TenantOrgRole';
import { validateMobile } from '@/utils/helper';

interface OrgUserInfoFormProps {
	close: MouseEventHandler<HTMLElement> | undefined;
	loading?: boolean;
	treeData?: any[];
	parentNode?: any;
}

const OrgUserInfoForm: React.FC<OrgUserInfoFormProps> = props => {
	return (
		<>
			<Form.Item name="userName" label="用户名" rules={[{ required: true, message: '请输入用户名' }]}>
				<Input placeholder="请输入用户名" maxLength={18} />
			</Form.Item>
			<Form.Item name="name" label="姓名" rules={[{ required: true, message: '请输入姓名' }]}>
				<Input placeholder="请输入姓名" maxLength={18} />
			</Form.Item>
			<Form.Item
				name="mobile"
				label="手机号"
				rules={[
					{
						validator: validateMobile,
					},
				]}>
				<Input placeholder="请输入手机号" />
			</Form.Item>
			<Form.Item name="sex" label="性别">
				<Radio.Group>
					<Radio value={1}>男</Radio>
					<Radio value={2}>女</Radio>
				</Radio.Group>
			</Form.Item>
			<Form.Item name="roleIds" label="角色绑定">
				<TenantOrgRole treeData={props.treeData} parentNode={props.parentNode} />
			</Form.Item>
		</>
	);
};

export default OrgUserInfoForm;
